home *** CD-ROM | disk | FTP | other *** search
/ Inside Mac Games Volume 5 #3 / IMG 46 Vol 5-3.iso / More Goodies / More For Your Game / Realmz / Character Master Source / Nemesis Framework / Sources / nemesis windows.cpp < prev   
Text File  |  1996-07-03  |  2KB  |  82 lines

  1. //••••••••••••••••••••••••••••••••••
  2. //    Some window utilites
  3. //••••••••••••••••••••••••••••••••••
  4.  
  5. extern    nemesisGlobalPtr    G;
  6.  
  7. void    NemesisGlobalToLocal ( WindowRef macWindow, Point globalPt, Point *localPt)
  8. {
  9.     GrafPtr        oldPort;
  10.     
  11.     // preserve and set port
  12.     GetPort(&oldPort);
  13.     SetPort(macWindow);
  14.     
  15.     // Convert the passed global point into local coords
  16.     *localPt = globalPt;
  17.     GlobalToLocal(localPt);
  18.  
  19.     // Restore the port
  20.     SetPort(oldPort);
  21. }
  22.  
  23. void    NemesisLocalToGlobal (WindowRef macWindow, Point localPt, Point *globalPt)
  24. {
  25.     GrafPtr        oldPort;
  26.     
  27.     // preserve and set port
  28.     GetPort(&oldPort);
  29.     SetPort(macWindow);
  30.     
  31.     // Convert the passed local point into global coords
  32.     *globalPt = localPt;
  33.     LocalToGlobal(globalPt);
  34.  
  35.     // Restore the port
  36.     SetPort(oldPort);
  37. }
  38.  
  39. Boolean    IsNemesisWindow( WindowRef theWindow )
  40. {    
  41.     Boolean isNemesisWindow = false;
  42.     
  43.     if( theWindow )
  44.     {
  45.         isNemesisWindow = ( GetWindowKind( theWindow ) == kNemesisWindowKind );
  46.     }
  47.     return isNemesisWindow;
  48. }
  49.  
  50. void    NemesisForceUpdate( WindowRef theWindow )
  51. {
  52.     GrafPtr            oldPort;
  53.     Rect            contentRect;
  54.  
  55.     // preserve existing port and set Quickdraw port
  56.     GetPort( &oldPort );
  57.     SetPort( theWindow );
  58.     
  59.     // get content area
  60.     contentRect = theWindow->portRect;
  61.  
  62.     // generate update event for that area
  63.     InvalRect( &contentRect );
  64.     
  65.     // restore port
  66.     SetPort( oldPort );
  67. }
  68.  
  69. void    NemesisForceUpdate( WindowRef theWindow, Rect theRect )
  70. {
  71.     GrafPtr            oldPort;
  72.  
  73.     // preserve existing port and set Quickdraw port
  74.     GetPort( &oldPort );
  75.     SetPort( theWindow );
  76.  
  77.     // generate update event for that area
  78.     InvalRect( &theRect );
  79.     
  80.     // restore port
  81.     SetPort( oldPort );
  82. }